home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / morse / robocopy / robo.alg < prev    next >
Text File  |  1990-09-21  |  7KB  |  118 lines

  1.  
  2.                              Thσ ROBO-COP┘ CW Algorithm
  3.  
  4.                                    Before we start writing the program,  we
  5.           have to decide on the algorithm (method) to be used to  time  the
  6.           dits  and dahs.  How does the computer decide that a "mark" (Mark
  7.           is the presence of signal, either dit or dah. Space is absence of
  8.           signal.) falls into the dit or dah category ?
  9.  
  10.                                    A  good approach to try would be to cal-
  11.           culate the average of some number of marks. The average, or as it
  12.           is called by statisticians, the arithmetic mean, is calculated by
  13.           adding up a number of related values then dividing  that  sum  by
  14.           that  number  of  values.    The  ARRL tells us that proper Morse
  15.           timing is that a dah is three times as long as a dit.  This means
  16.           that the calculated mark average should be 2 dits, assuming equal
  17.           numbers of dits and dahs.  As you  can  see  in  Figure  2,  this
  18.           average is an excellent point of reference for sorting marks into
  19.           dits and dahs.
  20.                             WPM = 2.4/(Average of Marks in milliseconds)
  21.  
  22.                                                 AVERAGE
  23.                                         DIT        |        DAH
  24.                                 |________|_________|_________|
  25.           Time in milliseconds 0ms      60ms      120ms     180ms
  26.           Deviation from mean             < -60ms > <  +60ms >
  27.  
  28.                                  Figure 2. Time values for 20 wpm cw.
  29.  
  30.                                           5
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.                                    The important factor here is the number
  38.           of marks used to calculate the average.  If that  number  is  too
  39.           small the average will become easily skewed by uneven occurrences
  40.           of either dits or dahs.  An example of this skew can be  seen  in
  41.           the phrase "1000 watt";  it contains 24 dahs but only 3 dits.  In
  42.           this example the average would quickly  converge  to  the  length
  43.           (time) of a dah.
  44.                                    If we select a very large number (>250)
  45.           of  samples  for  the  averaging calculation,  we can effectively
  46.           "swamp out" all but the most absurd of  the  "pathological"  pat-
  47.           terns  that  would significantly skew the average.  An additional
  48.           benefit to having a large number of samples in the average  would
  49.           be  better  noise  immunity should an errant value enter the cal-
  50.           culation due to QRM or QRN.
  51.  
  52.                                    A scheme based on a large sample average
  53.           would  work well if all cw operators could standardize on a fixed
  54.           baud rate,  much like the way the  asyncronous  serial  protocols
  55.           work.  Unfortunately, the real world of cw is anything but stand-
  56.           ard when it comes to transmission speed. CW speed not only varies
  57.           from  operator  to  operator  but it also changes if the operator
  58.           fatigues or desires to emphasize certain portions of  the  trans-
  59.           mission such as signal reports, QTH, etc.
  60.  
  61.                                    There are two major disadvantages to the
  62.           large sample average. The larger the number of samples used in an
  63.           average  the  less  responsive  to change it becomes.  When a big
  64.           change in the transmission rate is  encountered,  such  a  system
  65.           requires  an infusion of many dozens of new mark values before it
  66.           would have an accurate enough average to operate properly. During
  67.           this  time much of the QSO would have be lost in a sea of garbled
  68.           characters.   Large  sample  averages  are  also  computationally
  69.           intensive, restricting their use with only the fastest machines.
  70.  
  71.  
  72.                                    The MEAN Machine.
  73.  
  74.                                    ROBO-COPY's  algorithm  uses  a  smaller
  75.           number of samples, 32,  allowing it to "sync up" rapidly to vary-
  76.           ing  transmission rates.  The trick is to manage the entries that
  77.           are used in the calculation of the average.  First,  errant  mark
  78.           values  due  to  noise  are  reduced by the sampling filter that-
  79.           qualifies each mark as it happens.  Then a pre-screening function
  80.           ensures  that  skew  is minimized by disallowing more than 3 suc-
  81.           cesive marks of the same length (+/- 12.5%)  from  being  entered
  82.           into the average calculation.
  83.                                     Another  type  of statistical operation
  84.           used in ROBO-COPY is the mean deviation.  It is  used  to  detect
  85.           large changes in the transmission speed and adjust for dah to ditè          ratios that aren't 3:1.  The mean deviation is the difference be-
  86.           tween the average and the current mark value.  A  record  of  the
  87.           past  32  deviations  from average is maintained.  Figure 2 shows
  88.  
  89.                                           6
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.           that under nominal circumstances that the mean deviation  of  the
  97.           dit  and dah are of equal value but have different signs.  If you
  98.           add all 32 mean deviations together the dits and dahs will cancel
  99.           each  other  out and the sum will be near or at zero for "normal"
  100.           copy.
  101.  
  102.                                  If the speed of the incoming  code  should
  103.           change rapidly however,  like when you change frequency from a 13
  104.           wpm QSO to a 50 wpm QSO,  the mean deviation  really  "kicks-in".
  105.           When  the  value of the mean deviation exceeds 25% of the average
  106.           value,  the average is "opened-up" so that any mark will  be  in-
  107.           cluded  in  the calculation of the new average.  The program tem-
  108.           porarily suspends the pre-screening of entries into  the  average
  109.           in  an  effort  to purge the average of the out-of-date values it
  110.           contains.  After the mean deviation recedes back below 25% of the
  111.           average  value  the  program  will  again start the pre-screening
  112.           process using the new average as the basis for qualification.
  113.  
  114.                                   Becausσ oµ thesσ algorithms¼ ROB╧-COPY is
  115.           responsive to changing copy conditions,  yet stable without being
  116.           computationally cumbersome.
  117.  
  118.